package lesson2.example3;

import java.io.IOException;

import com.sun.tools.javap.JavapTask;

public class RunGetSetProcessor {
	
	public static String commonPath = "/Users/mazhi/Workspace/eclipse/eclipse_workspace/live-class";
	
	public static void main(String args[]) throws IOException {
		String str = commonPath + "/src/test/java/lesson2/example3/TestGetSetAnnotation.java";
		com.sun.tools.javac.main.Main compiler = new com.sun.tools.javac.main.Main("javac");
		args = new String[] { 
				 "-processor","lesson2.example3.GetSetProcessor",
				 "-processorpath",commonPath+"/src/test/java",
				 "-d","/Users/mazhi/Workspace/eclipse/eclipse_workspace/live-class/output",
				 str
			   };
		int rc = compiler.compile(args).exitCode;
		System.out.println("Result code: " + rc);
		
		decompile();
	}
	
	
	public static void decompile() {
		String[] args = new String[] { 
		    "-verbose",
		    commonPath + "/output/lesson2/example3/TestGetSetAnnotation.class" 
		};
		JavapTask t = new JavapTask();
        int rc = t.run(args);
        System.exit(rc);
	}

}
